@import '../styles/themes/default';

$modal: 'snake-modal';
$confirm: 'snake-confirm';

.#{$modal} {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: $zindexModal;
  outline: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  &-mask {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: $zindexModal;
  }

  &-wrapper {
    background: #fff;
    border-radius: $borderRadius;
    min-width: 500px;
    position: relative;
    color: rgba(0, 0, 0, 0.65);

    &-inner {
      padding: 24px;
      font-size: $body;
      line-height: $lineHeight;
      word-wrap: break-word;
    }
  }

  &-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e8e8e8;
  }

  &-title {
    color: rgba(0, 0, 0, 0.85);
    font-weight: 500;
    font-size: 16px;
    line-height: 22px;
  }

  &-close {
    position: absolute;
    right: 0;
    top: 0;
    color: rgba(0, 0, 0, 0.45);
    width: 55px;
    height: 55px;
    line-height: 55px;
    text-align: center;
    cursor: pointer;

    .snake-icon {
      font-size: 16px;
    }
  }

  &-body {
    &-contain {
      padding: 24px;
      font-size: 14px;
      line-height: 1.5;
      word-wrap: break-word;
    }
  }

  &-footer {
    padding: 10px 16px;
    text-align: right;
    border-top: 1px solid #e8e8e8;

    .snake-button {
      &:last-child {
        margin-left: 8px;
      }
    }
  }

  &-fade-appear,
  &-fade-enter {
    opacity: 0;
    animation-duration: 0.3s;
    animation-fill-mode: both;
    animation-timing-function: linear;
    animation-play-state: paused;
  }

  &-fade-appear-active,
  &-fade-enter-active {
    animation-name: modalFadeIn;
    animation-play-state: running;
  }

  &-fade-exit {
    animation-duration: 0.3s;
    animation-fill-mode: both;
    animation-timing-function: linear;
    animation-play-state: paused;
  }

  &-fade-exit-active {
    animation-name: modalFadeOut;
    animation-play-state: running;
  }

  &-zoom-appear,
  &-zoom-enter {
    opacity: 0;
    animation-duration: 0.3s;
    animation-fill-mode: both;
    animation-timing-function: $easeOutCirc;
    animation-play-state: paused;
  }

  &-zoom-appear-active,
  &-zoom-enter-active {
    animation-name: modalZoomIn;
    animation-play-state: running;
  }

  &-zoom-exit {
    animation-duration: 0.3s;
    animation-fill-mode: both;
    animation-timing-function: $easeOutCirc;
    animation-play-state: paused;
  }

  &-zoom-exit-active {
    animation-name: modalZoomOut;
    animation-play-state: running;
  }
}

.#{$confirm} {
  .#{$modal}-wrapper {
    min-width: 400px;
  }

  .#{$modal}-wrapper-inner {
    padding: 32px 32px 24px;
  }

  &-body-header {
    display: flex;
    align-items: center;
  }

  &-title {
    margin-left: 16px;
    color: rgba(0, 0, 0, 0.85);
  }

  &-content {
    margin-left: 40px;
    margin-top: 10px;
    color: rgba(0, 0, 0, 0.65);
  }

  &-btn {
    text-align: right;

    .snake-button {
      &:last-child {
        margin-left: 8px;
      }
    }
  }
}

@keyframes modalFadeIn {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes modalFadeOut {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes modalZoomIn {
  0% {
    opacity: 0;
    transform: scale(0.2);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes modalZoomOut {
  0% {
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(0.2);
  }
}
